#ifndef __PWM_H
#define __PWM_H

#include "gd32f20x.h"

extern __IO uint16_t new_fre;

#define GD32_TACH1_PORT	GPIOA
#define GD32_TACH2_PORT	GPIOA
#define GD32_TACH1_PIN	GPIO_PIN_0
#define GD32_TACH2_PIN	GPIO_PIN_1

#define TIMER1_ENABLE	timer_interrupt_enable(TIMER1, TIMER_INT_CH1);\
                        timer_enable(TIMER1)
                        

#define TIMER1_DISABLE	timer_interrupt_disable(TIMER1, TIMER_INT_CH1);\
                        timer_disable(TIMER1)


void timer_config(void);
void tach_config(void);
void timer_config(void);
uint32_t GetTimerCount(void);
uint32_t GetFreq(void);
void fan_pwm_set(uint8_t level);
void timer_configuration(void);
void ClearFreq(void);
void powerup_fan_pwm_set(uint8_t level);
#endif
